import ParamsUtil from '@/utils/params';
import Storage from '@/utils/storage';

interface KeyValue {
  [key: string]: string;
}

/**
 * 拼接pms h5链接
 * @param path h5链接
 * @param query 带入的参数
 * @returns
 */
export const getH5Url = async (path: string, query?: KeyValue): Promise<string> => {
  const token = await Storage.getItem('token');
  const base = `https://m.aunt.geekbuluo.com/#/${path}`;
  return ParamsUtil.addParams(base, { ...(query || {}), token });
};
